<div id="item_card_pager" class="jqpager" style="margin-bottom: 1px;"></div>		
<table class="table table-striped table-bordered" id="mainWechatMediaTable" style="padding-top: 5px;" border="0">
	<thead>
		<tr>
			<th><span style="vertical-align: middle;">&nbsp;&nbsp;卡券名称</span></th>
			<th>卡券类型</th>
			<th>库存</th>
			<th>卡券有效期</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody class="wechatMediaLotGrid"></tbody>
</table>
<!-- html 模板文件 -->
<script type="text/template" id="card_table_tr_tpl">
{{each list as item i}}
		<tr class="package" id="tr_id_{{i}}" quantity="{{item.quantity}}" card-id="{{item.cardId}}" card-name="{{item.cardName}}">
			<td>{{item.cardName}}</td>
            <td>
				{{if item.cardType == "DISCOUNT"}}折扣券
				{{else if item.cardType == "CASH"}}代金券
				{{else if item.cardType == "GIFT"}}兑换券
				{{else if item.cardType == "GROUPON"}}团购券
				{{else if item.cardType == "GENERAL_COUPON"}}优惠券
				{{/if}}
			</td>
            <td>{{item.quantity}}</td>
            <td>{{item.dateInfo}}</td>
			<td><a onclick="cardItem(this)"  class="btn btn-success">选择</a></td>
		</tr>
{{/each}}
</script>
<script type="text/template" id="card_table_noresult_tr_tpl">
	<tr class="package"><td class="center" colspan="5">没有数据</td></tr>
</script>
<script type="text/javascript">
var params = {};
params.active = $("#a_status_sel").val();
#if(cardType??)
	params.cardType = '#(cardType)';
#end
var table = new obz.TableView("item_card_pager", "#(webctx)/wechatCard/list", params, function(resp){
	$(".wechatMediaLotGrid").empty();
	if(resp && resp.list && resp.list.length>0){
		$('.wechatMediaLotGrid').html(template('card_table_tr_tpl', resp));
		TBatch.tableId = "mainWechatMediaTable";
		//初始化checkbox点击事件
		TBatch.checkCheckbox();
		TBatch.initCheckboxClick();
	}else{
		$(".wechatMediaLotGrid").append($("#card_table_noresult_tr_tpl").html());
	}
});
table.init();
</script>